//
//  QuestionOfQuestionsAndAnswers.m
//  LCOnePsychology
//
//  Created by li cheng on 16/09/05
//  Copyright (c) __ORGANIZATIONNAME__. All rights reserved.
//

#import "QuestionOfQuestionsAndAnswers.h"
#import "TagsOfQuestion.h"
#import "UserOfQuestion.h"
#import "AnswerOfQuestion.h"
@implementation QuestionOfQuestionsAndAnswers

+ (NSDictionary *)objectClassInArray{
    return @{@"tags" : [TagsOfQuestion class]};
}

- (void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"user"]) {
        UserOfQuestion *userOfQuestion = [UserOfQuestion modelDic:value];
        _user = userOfQuestion;
    }
    if ([key isEqualToString:@"answer"]) {
        AnswerOfQuestion *answerOfQuestion = [AnswerOfQuestion modelDic:value];
        _answer = answerOfQuestion;
    }
    if ([key isEqualToString:@"tags"]) {
        NSMutableArray<TagsOfQuestion *> *mArrayOfTagsOfQuestion = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            TagsOfQuestion *tagsOfQuestion = [TagsOfQuestion modelDic:dic];
            [mArrayOfTagsOfQuestion addObject:tagsOfQuestion];
        }
        _tags = mArrayOfTagsOfQuestion;
    }
}
@end
